<?php

require '../model/speedsetmodel.php';

class speedsetcontrol{
	private $model;//业务模型
	private $view;

	public function __construct(){
		
		$this->view="../view/main.php?url=speedset.php";
		$this->model=new speedsetmodel();
		
		
	}


	public function load($view=null){
		if(empty($view))
		{				
			header("location:{$this->view}");
		}
		else{
			header("location:{$view}");
		}

	}
	public function doAction($action){


		if($action=='crush'){
			
			$this->action_crush();
		}
		else if ($action=='crushmax'){
			
			$this->action_crushmax();
		}
		else{
			$this->load();
		}

	}

	//修改碰撞值
	public function action_crush(){
		$crush=$_POST['crush'];
		//echo "444".$crush;
		if (!empty($crush)){
			$crush1=new speedsetmodel();
			$crush1->crush($crush);
		}
		//回自己界面
		$this->load($this->view);
	}
	//修改最大碰撞值
	public function action_crushmax(){
		$crushmax=$_POST['crushmax'];
		if (!empty($crushmax)){
			$crushmax1=new speedsetmodel();
			$crushmax1->crushmax($crushmax);//此处的$crushmax和$crushmax1
			                                //一定要用不同名称，否则识别不出来
		}
		//回自己界面
		$this->load($this->view);
		
	}
	
}
?>